#include"http/http.hpp"

//测试 大文件传输测试
//sheel脚本命令：dd if=/dev/zero of=./hello.txt bs=100M count=3
//创建一个名字为hello.txt的300M文件,文件内容来自/dev/zero

int main()
{
    Socket client_sock;
    client_sock.CreateClient(8888,"127.0.0.1");
    std::string httprequest;
    std::string body;
    Util::ReadFile("hello.txt",&body);
    httprequest += "PUT /1234.txt HTTP/1.1\r\nConnection: keep-alive\r\n";
    httprequest += "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n";
    assert(client_sock.Send(httprequest.c_str(),httprequest.size()) != -1);
    assert(client_sock.Send(body.c_str(),body.size()) != -1);
    char buffer[1024] = {0};
    assert(client_sock.Recv(buffer,1023) != -1);

    DBG_LOG("[%s]",buffer);

    sleep(3);
    client_sock.Close();
    return 0;
}